import QtQuick 2.4

Item {

    width: 320
    height: 240
    property real dashneedle_Rotation: 0
    property alias dash_type: element.text
    Image {
        id: image_dashbase
        x: 0
        y: 0
        rotation: 0
        fillMode: Image.PreserveAspectFit
        source: "dash2-1.png"

        Image {
            id: image_dashneedle
            y: 25
            width: 13
            height: 102
//            rotation: -100
            /*{
                if(dashneedle_Rotation.toFixed(2)>200)
                    200;
                else if(dashneedle_Rotation.toFixed(2)<0)
                    0;
                else
                    dashneedle_Rotation.toFixed(2)-100;
            }*/
//            transitions:Transition {
//                RotationAnimation {
//                    id : animation_rota
//                    property: "rotation"
//                    duration: 500
//                    running: true
//                }
//            }
            transform:Rotation{
                origin.x: 6.5
                origin.y: 102
                angle: {
                    if(dashneedle_Rotation.toFixed(2)>200)
                        100;
                    else if(dashneedle_Rotation.toFixed(2)<0)
                        -100;
                    else
                        dashneedle_Rotation.toFixed(2)-100;
                }
                Behavior on angle {
                    SmoothedAnimation{
                        duration:5000
                        easing.type: Easing.InQuad
                    }
                }
            }


            property string property0: "none.none"
            anchors.left: focusScope.right
            anchors.leftMargin: 0
            anchors.bottomMargin: 0
            anchors.bottom: focusScope.top
            opacity: 1
            clip: false
            transformOrigin: Item.Bottom
            z: 0
            scale: 1
            sourceSize.height: 96
            sourceSize.width: 100
            fillMode: Image.PreserveAspectFit
            source: "needle.png"
        }

        FocusScope {
            id: focusScope
            x: 142
            y: 164
            width: 12
            height: 18

            Text {
                id: element
                x: 8
                y: 17
                text: qsTr("DEST")
                font.pixelSize: 24
                anchors.horizontalCenterOffset: 14
                anchors.horizontalCenter: parent.horizontalCenter
                verticalAlignment: Text.AlignTop
                horizontalAlignment: Text.AlignLeft
                font.family: "Courier"
                lineHeight: 1
            }

            Text {
                id: element1
                x: 15
                y: 42
                text: dashneedle_Rotation.toFixed(2).toString()+qsTr("%")
                anchors.right: parent.right
                anchors.rightMargin: -45
                font.family: "Courier"
                lineHeight: 1
                verticalAlignment: Text.AlignTop
                anchors.horizontalCenterOffset: 14
                horizontalAlignment: Text.AlignLeft
                anchors.horizontalCenter: parent.horizontalCenter
                font.pixelSize: 24
            }
        }
    }
}










































/*##^## Designer {
    D{i:2;anchors_height:133;anchors_width:10;anchors_x:"-15"}
}
 ##^##*/
